"""
自定义解析器
"""
from langchain_core.messages import AIMessage
from langchain_core.runnables import RunnableLambda
from models import get_ds_model_client

# 常用方式, 使用LCEL中的RunnableLambda
def parse(ai_message: AIMessage):
    return ai_message.content.swapcase()

client = get_ds_model_client()
chain = client | RunnableLambda(parse)
print(chain.invoke("hello world"))